****************************************************************************
**************************************
*generated: 2025-04
*
*by Lukas Rudolph
*
*Data used:  nimby_replication_data.dta ; tabA7_A8_figA1_A2_replication_data.dta
*Data output generated: none
*Tables generated: Tables 1 and 2, Appendix Tables A.1-A.16 and B.1-B.4
*Figutes generated: Figures 2-7, Appendix Figures A.4-A.8 and B.3-B.7
**************************************
****************************************************************************
 
********************************************************
*set working directory
********************************************************
cd // set working directory to folder containing the dataset

 
********************************************************
*prep stata
********************************************************

clear all
*install necessary packages, if not already installed
*grstyle, estout

********************************************************
*set grstyle for nice figure layout
********************************************************

grstyle init
grstyle set plain, horizontal grid
grstyle set color Dark2  
grstyle set legend 2, inside nobox

********************************************************
*output directories
********************************************************

global tab = "tables" // uncomment "using ...tex" in do-file to directly save tables
global fig = "figures" // uncomment "graph export ...eps, replace" in do-file to directly save figures


********************************************************
*load data
********************************************************

use nimby_replication_data.dta, clear

********************************************************
*define control variable vectors
********************************************************

global controls = "polytwo1 polytwo2"
global pca = "pca1 pca2"
global pcacomponents = "w5_q5 i.( w5_q29  w5_q30x1 w5_q30x2 w5_q30x8) "
global pcabinary = "benefitshigh costshigh "
global soziodem = "i.language rural i.agecat  i.marital_3cat  i.hhsize i.nationality_Swiss i.edu i.income i.leftright"
global balancetest = "treat2_300m treat1_300m treat2_500m treat1_500m closest_antenna_treat2 closest_antenna_treat1 treat2_rect treat1_rect  lang_? rural gender_male agecat_?  marital_3cat_?  hhsize_? nationality_Swiss edu_? income_? leftright_? pca1 pca2 polytwo1 polytwo2"

********************************************************
*set survey weights
********************************************************

svyset PubId [pweight=w5_weightA]



********************************************************************************
********************************************************
* Main Tables and Figures (in order of appearance)
********************************************************
********************************************************************************


********************************************************************************
* Figure 2
********************************************************************************

proportion w5_q20 if benefitshigh==1 & w5_conjointgroup == 0
estimates store benefits_above_median

proportion w5_q20 if benefitshigh==0 & w5_conjointgroup == 0
estimates store benefits_below_median

coefplot (benefits_above_median, label("Benefits above median")) (benefits_below_median, label("Benefits below median")), xtitle(Support for 5G network expansion) ytitle(Proportion) ///
     vertical recast(bar) barwidth(0.25) finten(60) xlabel(1 "strongly against"  2 3 4 5 6 7 8 "strongly in favor") ylabel(0(.05).25) ///
    citop citype(logit) ciopt(recast(rcap)) rename(*.w5_q20 = "") name(one, replace)


proportion w5_q20 if costshigh==0 & w5_conjointgroup == 0
estimates store costs_below_median
 
proportion w5_q20 if costshigh==1 & w5_conjointgroup == 0
estimates store costs_above_median

coefplot  (costs_below_median, label("Costs below median")) (costs_above_median, label("Costs above median")), xtitle(Support for 5G network expansion) ytitle(Proportion) ///
     vertical recast(bar) barwidth(0.25) finten(60) xlabel(1 "strongly against" 2 3 4 5 6 7 8 "strongly in favor")  ///
    citop citype(logit) ciopt(recast(rcap)) rename(*.w5_q20 = "") name(two, replace)

graph combine one two, row(2)

 // graph export "$fig\Figure2.eps", replace


********************************************************************************
* Table 1
********************************************************************************

eststo clear

eststo: svy: reg w5_q18rev   $pca  if w5_conjointgroup == 0 
eststo: svy: reg w5_q18v3  $pca if w5_conjointgroup == 0  
eststo: svy: reg w5_q20    $pca if w5_conjointgroup == 0  ,  
eststo: svy: reg w5_q20bin    $pca  if w5_conjointgroup == 0  

esttab   ///   using "$tab\Table1.tex" ///
, stats(N r2 ) label  nobaselevels  se nonote replace star(+ 0.1 * 0.05 ** 0.01 *** 0.001)



********************************************************************************
* Table 2 
********************************************************************************

eststo clear

eststo: svy: reg w5_q18v3 i.w5_conjointgroup $pca if w5_conjointgroup<2
eststo: svy: reg w5_q19v3 i.w5_conjointgroup $pca if w5_conjointgroup<2
eststo: svy: reg w5_q20 i.w5_conjointgroup $pca if w5_conjointgroup<2
eststo: svy: reg w5_q21 i.w5_conjointgroup $pca if w5_conjointgroup<2

esttab /// using "$tab\Table2.tex" ///
, stats(N r2 ) label  nobaselevels  se nonote replace star(+ 0.1 * 0.05 ** 0.01 *** 0.001) order(*w5_conjointgroup* )  ///
mgroups("5G", pattern(1 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span)


********************************************************************************
* Figure 3
********************************************************************************

eststo clear

svy: reg w5_q18v3 i.w5_conjointgroup##ib3.proximity_5Gv2 $pca if w5_conjointgroup<2 
margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4) )
matrix list r(table)
mat table = r(table)
mat pval = round(table[4,5],.001),round(table[4,6],.001),round(table[4,7],.01),round(table[4,8],.00001)
mat list pval
mat beta = round(table[1,5],.01),round(table[1,6],.01),round(table[1,7],.01),round(table[1,8],.01)
mat list beta

svy: reg w5_q18v3 i.w5_conjointgroup##ib3.proximity_5Gv2 $pca if w5_conjointgroup<2 
margins , at(proximity_5Gv2 = (1 2 3 4) w5_conjointgroup = (0 1) ) post
matrix list r(table)
mat table = r(table)
mat coef = table[1,5],table[1,6],table[1,7],table[1,8]
tempvar tvar1
tempvar tvar2
tempvar tvar3
tempvar tvar4
tempvar tvar5
tempvar tvar6
tempvar tvar8

gen `tvar1' = . 
gen `tvar2' = . 
gen `tvar3' = . 
gen `tvar5' = . 
gen `tvar8' = . 

replace `tvar1' = coef[1,1] in 1
replace `tvar8' = `tvar1' - 0.012 in 1
replace `tvar2' = pval[1,1] in 1
replace `tvar3' = 1.125 in 1
replace `tvar5' = beta[1,1] in 1
replace `tvar1' = coef[1,2] in 2
replace `tvar8' = `tvar1' - 0.012 in 2
replace `tvar2' = pval[1,2] in 2
replace `tvar3' = 2.125 in 2
replace `tvar5' = beta[1,2] in 2
replace `tvar1' = coef[1,3] in 3
replace `tvar8' = `tvar1' - 0.012 in 3
replace `tvar2' = pval[1,3] in 3
replace `tvar3' = 3.125 in 3
replace `tvar5' = beta[1,3] in 3
replace `tvar1' = coef[1,4] in 4
replace `tvar8' = `tvar1' - 0.012 in 4
replace `tvar2' = pval[1,4] in 4
replace `tvar3' = 4.125 in 4
replace `tvar5' = beta[1,4] in 4

gen  `tvar4' = string(`tvar2')
gen  `tvar6' = string(`tvar5')
replace `tvar6' = "{it:" + `tvar6' + "}"   in 1/4
replace `tvar4' = "{it:" + "(" + `tvar4' + ")" +"}"   in 1/4
replace `tvar4' = "{it:" + `tvar6'  + `tvar4' + "}"   in 1/5

mplotoffset, offset(0.25)  recast(scatter)  xtitle("") title("Worry for antenna proximity by 5G map treatment and distance") ///
ylabel(0.1(.1)0.6) ///
 addplot( scatter `tvar1' `tvar3' ,  mlab(`tvar4') mlabcolor(black) mcolor(none) legend(order(3 "control group" 4 "5G map treatment" 5 "{it:diff. (p-val.)}"))  xmtick(4.5, tstyle(none)))
 
 // graph export $fig\Figure3.eps, replace
 


********************************************************************************
* Figure 4
********************************************************************************

eststo clear

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $pca  if w5_conjointgroup<2 , 

margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4) )
matrix list r(table)
mat table = r(table)
mat pval = round(table[4,5],.01),round(table[4,6],.01),round(table[4,7],.01),round(table[4,8],.01)
mat list pval
mat beta = round(table[1,5],.01),round(table[1,6],.01),round(table[1,7],.01),round(table[1,8],.01)
mat list beta

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $pca  if w5_conjointgroup<2 , 

margins , at(proximity_5Gv2 = (1 2 3 4) w5_conjointgroup = (0 1) ) post
matrix list r(table)
mat table = r(table)
mat coef = table[1,5],table[1,6],table[1,7],table[1,8]
tempvar tvar1
tempvar tvar2
tempvar tvar3
tempvar tvar4
tempvar tvar5
tempvar tvar6

gen `tvar1' = . 
gen `tvar2' = . 
gen `tvar3' = . 
gen `tvar5' = . 

replace `tvar1' = coef[1,1] in 1
replace `tvar2' = pval[1,1] in 1
replace `tvar3' = 1.125 in 1
replace `tvar5' = beta[1,1] in 1
replace `tvar1' = coef[1,2] in 2
replace `tvar2' = pval[1,2] in 2
replace `tvar3' = 2.125 in 2
replace `tvar5' = beta[1,2] in 2
replace `tvar1' = coef[1,3] in 3
replace `tvar2' = pval[1,3] in 3
replace `tvar3' = 3.125 in 3
replace `tvar5' = beta[1,3] in 3
replace `tvar1' = coef[1,4] in 4
replace `tvar2' = pval[1,4] in 4
replace `tvar3' = 4.125 in 4
replace `tvar5' = beta[1,4] in 4

gen  `tvar4' = string(`tvar2')
gen  `tvar6' = string(`tvar5')
replace `tvar4' = "{it:" + `tvar6' + "(" + `tvar4' + ")" + "}"   in 1/4

 mplotoffset, offset(0.25)  recast(scatter)  xtitle("") name(one, replace) title("Support for 5G network expansion by 5G map treatment and distance")  ///
 addplot(scatter `tvar1' `tvar3' ,  mlab(`tvar4') mlabcolor(black) mcolor(none) msymbol(none) legend(order(3 "control group" 4 "5G map treatment" 5 "{it:diff. (p-val.)}")) ylabel(3(.2)4) ) xmtick(4.5, tstyle(none))

 // graph export "$fig\Figure4.eps", replace



********************************************************************************
* Figure 5
********************************************************************************

eststo clear

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $pca if w5_conjointgroup<2 & benefitshigh == 1  , 

margins ib1.proximity_5Gv2, dydx(i.w5_conjointgroup) post 

svy: reg w5_q20 i.w5_conjointgroup $pca if proximity_5Gv2 == 1 & w5_conjointgroup<2 & benefitshigh == 1  , 


** Panel 1
svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $pca if w5_conjointgroup<2 & benefitshigh == 0   , 

margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4) )
matrix list r(table)
mat table = r(table)
mat pval = round(table[4,5],.01),round(table[4,6],.01),round(table[4,7],.01),round(table[4,8],.01)
mat list pval
mat beta = round(table[1,5],.01),round(table[1,6],.01),round(table[1,7],.01),round(table[1,8],.01)
mat list beta

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $pca if w5_conjointgroup<2 & benefitshigh == 0   , 

margins , at(proximity_5Gv2 = (1 2 3 4) w5_conjointgroup = (0 1) ) post
matrix list r(table)
mat table = r(table)
mat coef = table[1,5],table[1,6],table[1,7],table[1,8]
tempvar tvar1
tempvar tvar2
tempvar tvar3
tempvar tvar4
tempvar tvar5
tempvar tvar6

gen `tvar1' = . 
gen `tvar2' = . 
gen `tvar3' = . 
gen `tvar5' = . 

replace `tvar1' = coef[1,1] in 1
replace `tvar2' = pval[1,1] in 1
replace `tvar3' = 1.125 in 1
replace `tvar5' = beta[1,1] in 1
replace `tvar1' = coef[1,2] in 2
replace `tvar2' = pval[1,2] in 2
replace `tvar3' = 2.125 in 2
replace `tvar5' = beta[1,2] in 2
replace `tvar1' = coef[1,3] in 3
replace `tvar2' = pval[1,3] in 3
replace `tvar3' = 3.125 in 3
replace `tvar5' = beta[1,3] in 3
replace `tvar1' = coef[1,4] in 4
replace `tvar2' = pval[1,4] in 4
replace `tvar3' = 4.125 in 4
replace `tvar5' = beta[1,4] in 4

gen  `tvar4' = string(`tvar2')
gen  `tvar6' = string(`tvar5')
replace `tvar4' = "{it:" + `tvar6' + "(" + `tvar4' + ")" + "}"   in 1/4
label variable `tvar1'  ""
 mplotoffset, offset(0.25)  recast(scatter)  xtitle("") name(one, replace) title("Resp.: below median benefits")  ///
 addplot(scatter `tvar1' `tvar3' ,  mlab(`tvar4') mlabcolor(black) mcolor(none) legend(order(3 "control group" 4 "5G" 5 "{it:diff. (p-val.)}")) ylabel(2(.25)5) ) xmtick(4.5, tstyle(none))  
  tab `tvar1' `tvar3'


** Panel 2
svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $pca if w5_conjointgroup<2 & benefitshigh == 1  , 

margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4) )
matrix list r(table)
mat table = r(table)
mat pval = round(table[4,5],.01),round(table[4,6],.01),round(table[4,7],.01),round(table[4,8],.01)
mat list pval
mat beta = round(table[1,5],.01),round(table[1,6],.01),round(table[1,7],.01),round(table[1,8],.01)
mat list beta

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $pca if w5_conjointgroup<2 & benefitshigh == 1  , 

margins , at(proximity_5Gv2 = (1 2 3 4) w5_conjointgroup = (0 1) ) post
matrix list r(table)
mat table = r(table)
mat coef = table[1,5],table[1,6],table[1,7],table[1,8]
tempvar tvar1
tempvar tvar2
tempvar tvar3
tempvar tvar4
tempvar tvar5
tempvar tvar6

gen `tvar1' = . 
gen `tvar2' = . 
gen `tvar3' = . 
gen `tvar5' = . 

replace `tvar1' = coef[1,1] in 1
replace `tvar2' = pval[1,1] in 1
replace `tvar3' = 1.125 in 1
replace `tvar5' = beta[1,1] in 1
replace `tvar1' = coef[1,2] in 2
replace `tvar2' = pval[1,2] in 2
replace `tvar3' = 2.125 in 2
replace `tvar5' = beta[1,2] in 2
replace `tvar1' = coef[1,3] in 3
replace `tvar2' = pval[1,3] in 3
replace `tvar3' = 3.125 in 3
replace `tvar5' = beta[1,3] in 3
replace `tvar1' = coef[1,4] in 4
replace `tvar2' = pval[1,4] in 4
replace `tvar3' = 4.125 in 4
replace `tvar5' = beta[1,4] in 4

gen  `tvar4' = string(`tvar2')
gen  `tvar6' = string(`tvar5')
replace `tvar4' = "{it:" + `tvar6' + "(" + `tvar4' + ")" + "}"   in 1/4
label variable `tvar1'  ""

  grstyle set legend 5, inside nobox

 mplotoffset, offset(0.25)  recast(scatter)  xtitle("") name(two, replace) title("Resp.: above median benefits") ///
 addplot(scatter `tvar1' `tvar3' ,  mlab(`tvar4') mlabcolor(black) mcolor(none) legend(order(3 "control group" 4 "5G" 5 "{it:diff. (p-val.)}")) ylabel(2(.25)5) ) xmtick(4.5, tstyle(none))  
  tab `tvar1' `tvar3'

    grstyle set legend 2, inside nobox

graph combine  two one, cols(1) name(leftside, replace) 

** Panel 3
svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $pca if w5_conjointgroup<2  &  costshigh == 0, 

margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4) )
matrix list r(table)
mat table = r(table)
mat pval = round(table[4,5],.01),round(table[4,6],.01),round(table[4,7],.01),round(table[4,8],.01)
mat list pval
mat beta = round(table[1,5],.01),round(table[1,6],.01),round(table[1,7],.01),round(table[1,8],.01)
mat list beta

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $pca if w5_conjointgroup<2  &  costshigh == 0, 

margins , at(proximity_5Gv2 = (1 2 3 4) w5_conjointgroup = (0 1) ) post
matrix list r(table)
mat table = r(table)
mat coef = table[1,5],table[1,6],table[1,7],table[1,8]
tempvar tvar1
tempvar tvar2
tempvar tvar3
tempvar tvar4
tempvar tvar5
tempvar tvar6

gen `tvar1' = . 
gen `tvar2' = . 
gen `tvar3' = . 
gen `tvar5' = . 

replace `tvar1' = coef[1,1] in 1
replace `tvar2' = pval[1,1] in 1
replace `tvar3' = 1.125 in 1
replace `tvar5' = beta[1,1] in 1
replace `tvar1' = coef[1,2] in 2
replace `tvar2' = pval[1,2] in 2
replace `tvar3' = 2.125 in 2
replace `tvar5' = beta[1,2] in 2
replace `tvar1' = coef[1,3] in 3
replace `tvar2' = pval[1,3] in 3
replace `tvar3' = 3.125 in 3
replace `tvar5' = beta[1,3] in 3
replace `tvar1' = coef[1,4] in 4
replace `tvar2' = pval[1,4] in 4
replace `tvar3' = 4.125 in 4
replace `tvar5' = beta[1,4] in 4

gen  `tvar4' = string(`tvar2')
gen  `tvar6' = string(`tvar5')
replace `tvar4' = "{it:" + `tvar6' + "(" + `tvar4' + ")" + "}"   in 1/4
label variable `tvar1'  ""

  grstyle set legend 5, inside nobox

 mplotoffset, offset(0.25)  recast(scatter)  xtitle("") name(three, replace) title("Resp.: below median costs")  ///
 addplot(scatter `tvar1' `tvar3' ,  mlab(`tvar4') mlabcolor(black) mcolor(none) legend(order(3 "control group" 4 "5G map treatment" 5 "{it:diff. (p-val.)}")) ylabel(2(.25)5) ) xmtick(4.5, tstyle(none))  

   grstyle set legend 2, inside nobox

 tab `tvar1' `tvar3'


** Panel 4
svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $pca if w5_conjointgroup<2  &  costshigh == 1, 

margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4) )
matrix list r(table)
mat table = r(table)
mat pval = round(table[4,5],.01),round(table[4,6],.01),round(table[4,7],.01),round(table[4,8],.01)
mat list pval
mat beta = round(table[1,5],.01),round(table[1,6],.01),round(table[1,7],.01),round(table[1,8],.01)
mat list beta

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $pca if w5_conjointgroup<2  &  costshigh == 1, 

margins , at(proximity_5Gv2 = (1 2 3 4) w5_conjointgroup = (0 1) ) post
matrix list r(table)
mat table = r(table)
mat coef = table[1,5],table[1,6],table[1,7],table[1,8]
tempvar tvar1
tempvar tvar2
tempvar tvar3
tempvar tvar4
tempvar tvar5
tempvar tvar6

gen `tvar1' = . 
gen `tvar2' = . 
gen `tvar3' = . 
gen `tvar5' = . 

replace `tvar1' = coef[1,1] in 1
replace `tvar2' = pval[1,1] in 1
replace `tvar3' = 1.125 in 1
replace `tvar5' = beta[1,1] in 1
replace `tvar1' = coef[1,2] in 2
replace `tvar2' = pval[1,2] in 2
replace `tvar3' = 2.125 in 2
replace `tvar5' = beta[1,2] in 2
replace `tvar1' = coef[1,3] in 3
replace `tvar2' = pval[1,3] in 3
replace `tvar3' = 3.125 in 3
replace `tvar5' = beta[1,3] in 3
replace `tvar1' = coef[1,4] in 4
replace `tvar2' = pval[1,4] in 4
replace `tvar3' = 4.125 in 4
replace `tvar5' = beta[1,4] in 4

gen  `tvar4' = string(`tvar2')
gen  `tvar6' = string(`tvar5')
replace `tvar4' = "{it:" + `tvar6' + "(" + `tvar4' + ")" + "}"   in 1/4
label variable `tvar1'  ""
 mplotoffset, offset(0.25)  recast(scatter)  xtitle("") name(four, replace) title("Resp.: above median costs") ///
 addplot(scatter `tvar1' `tvar3' ,  mlab(`tvar4') mlabcolor(black) mcolor(none) legend(order(3 "control group" 4 "5G map treatment" 5 "{it:diff. (p-val.)}")) ylabel(2(.25)5) ) xmtick(4.5, tstyle(none))  
  tab `tvar1' `tvar3'

** Combine into one plot and save
graph combine  four three, cols(1) name(rightside, replace) 

graph combine  leftside rightside , t1title("Support for 5G network expansion by 5G map treatment and distance, subgroups")

// graph export "$fig\Figure5.eps", replace  

* Additional calculations

*compare effect size to control group mean and control group sd -- for benefitshigh

sum w5_q20 if w5_conjointgroup==0 &  benefitshigh == 0, d
sum w5_q20 if w5_conjointgroup==0 &  benefitshigh == 1, d

tab w5_q20 if w5_conjointgroup==0 &  benefitshigh == 0,  

sum w5_q20 if w5_conjointgroup==0 & proximity_5Gv2==1 & benefitshigh == 1, d
di 0.42/r(mean)
di 0.42/r(sd)

sum w5_q20 if w5_conjointgroup==0 & proximity_5Gv2==2 & benefitshigh == 1, d
di 0.44/r(mean)
di 0.44/r(sd)

*compare effect size to control group mean and control group sd -- for costshigh

sum w5_q20 if w5_conjointgroup==0 &  costshigh == 0, d
sum w5_q20 if w5_conjointgroup==0 &  costshigh == 1, d

tab w5_q20 if w5_conjointgroup==0 &  costshigh == 1,  

sum w5_q20 if w5_conjointgroup==0 & proximity_5Gv2==1 & costshigh == 0, d
di 0.29/r(mean)
di 0.29/r(sd)

sum w5_q20 if w5_conjointgroup==0 & proximity_5Gv2==2 & costshigh == 0, d
di 0.43/r(mean)
di 0.43/r(sd)

********************************************************************************
* Figure 6
********************************************************************************

eststo clear

svy: reg w5_q25yes i.(w5_q25_treat1_de w5_q25_treat2_de w5_q25_treat3_de) polytwo1 polytwo2   if w5_conjointgroup == 0  

eststo w5_q25yes: margins w5_q25_treat1_de w5_q25_treat2_de w5_q25_treat3_de, post
coefplot (w5_q25yes ,   xscale(range(0.2(.05)0.4) ) ) , ///  
drop(_cons)   baselevels byopts(xrescale) yline(5.5 9.5   , lcol(grey) lpattern(dash)) ///
title("Support for an appeal against a new 5G antenna" "by distance, costs and benefits")

// graph export "$fig\Figure6.eps", replace

********************************************************************************
* Figure 7
********************************************************************************

eststo clear

svy: reg w5_q25yes i.w5_q25_treat1_de##ib2.w5_q25_treat2_de polytwo1 polytwo2   if w5_conjointgroup == 0

margins i.w5_q25_treat1_de##i.w5_q25_treat2_de, post atmeans
mplotoffset, bydimension(w5_q25_treat1_de,    ) recast(scatter) xscale(range(0.5(1)4.5)) ///
 xlabel(1 "(empty)" 2 "10" 3 "100" 4 "300") ciopts(recast(.)) ///
 xtitle(Cost of appeal) ytitle(Linear prediction for appeal probability) byopts(title("") title("Support for an appeal against a new 5G antenna" "interacting distance and costs")) //
 
// graph export "$fig\Figure7.eps", replace


****************************************************************************************************************
********************************************************
* Appendix A Tables and Figures (in order of appearance)
********************************************************
****************************************************************************************************************


********************************************************
* Table A.1
********************************************************

eststo clear

eststo one:  estpost ttest $balancetest  if w5_conjointgroup<2, ///
by(w5_conjointgroup)   //

eststo two:  estpost ttest $balancetest if w5_conjointgroup!=1, ///
by(w5_conjointgroup)

esttab one two  /// using "$tab\tabA1.tex"                ///
 , mtitles() label replace compress star(+ 0.1 * 0.05 ** 0.01 *** 0.001) ///
 cells("mu_1(fmt(%12.2f) label(C)) mu_2(fmt(%12.2f) label(T)) b(fmt(%12.2f) star label(Diff-In-Means)) N_1(fmt(%12.0f) label(N C)) N_2(fmt(%12.0f) label(N T))" ///
 "mean mean se(par fmt(2))" ". . .")

********************************************************************************
* Table A.2
********************************************************************************

eststo clear

eststo: svy: reg comprmatch5G i.w5_conjointgroup $pca
eststo: svy: reg comprmatch5G i.w5_conjointgroup##ib3.proximity_5Gv2 $pca
eststo: svy: reg comprmatch5Gv2 i.w5_conjointgroup $pca
eststo: svy: reg comprmatch5Gv2 i.w5_conjointgroup##ib3.proximity_5Gv2 $pca

esttab /// using "$tab\tabA2.tex" ///
, stats(N r2 ) label  nobaselevels  se nonote replace star(+ 0.1 * 0.05 ** 0.01 *** 0.001)order(*w5_conjointgroup* *proximity_5Gv2*)  ///
mgroups("5G", pattern(1 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span)

********************************************************************************
* Figure A.4
********************************************************************************

svy: reg comprmatch5G i.w5_conjointgroup##ib3.proximity_5Gv2 $pca if w5_conjointgroup<2 
margins , at(proximity_5Gv2 = (1 2 3 4) w5_conjointgroup = (0 1) ) post
mplotoffset, offset(0.25)  recast(scatter)  xtitle("") name(one, replace) title("Comprehension by distance and 5G treat.")

// graph export "$fig\figA4.eps", replace

********************************************************************************
* Table A.3
********************************************************************************

eststo clear

eststo: svy: reg w5_q18v3 i.w5_conjointgroup $pca if w5_conjointgroup<2
eststo: svy: reg w5_q18v3 i.w5_conjointgroup##ib3.proximity_5Gv2 $pca if w5_conjointgroup<2
eststo: svy: reg w5_q18 i.w5_conjointgroup $pca if w5_conjointgroup<2
eststo: svy: reg w5_q18 i.w5_conjointgroup##ib3.proximity_5Gv2 $pca if w5_conjointgroup<2

esttab /// using "$tab\tabA3.tex" ///
, stats(N r2 ) label  nobaselevels  se nonote replace star(+ 0.1 * 0.05 ** 0.01 *** 0.001) order(*w5_conjointgroup* *proximity_5Gv2* ) ///
mgroups("5G and 3/4G" "5G", pattern(1 1 1 1) prefix(\multicolumn{@span}{c}{) suffix(}) span)

********************************************************************************
* Table A.4
********************************************************************************

eststo clear

eststo: svy: reg w5_q19v3 i.w5_conjointgroup $pca if w5_conjointgroup<2
eststo: svy: reg w5_q19v3 i.w5_conjointgroup##ib0.amount_5G $pca if w5_conjointgroup<2
eststo: svy: reg w5_q19 i.w5_conjointgroup $pca if w5_conjointgroup<2
eststo: svy: reg w5_q19 i.w5_conjointgroup##ib0.amount_5G $pca if w5_conjointgroup<2

esttab /// using "$tab\tabA4.tex" ///
, stats(N r2 ) label  nobaselevels  se nonote replace star(+ 0.1 * 0.05 ** 0.01 *** 0.001)order(*w5_conjointgroup* *amount_5G*)  ///
mgroups("5G and 3/4G" "5G" "5G and 3/4G" "5G", pattern(1 1 1 1) prefix(\multicolumn{@span}{c}{) suffix(}) span)

********************************************************************************
* Figure A.5
********************************************************************************

svy: reg w5_q19v3 i.w5_conjointgroup##ib0.amount_5G $pca if w5_conjointgroup<2 
margins , dydx(w5_conjointgroup) at(amount_5G = (0 1 2 3 4) )
matrix list r(table)
mat table = r(table)
mat pval = round(table[4,6],.001),round(table[4,7],.01),round(table[4,8],.0001),round(table[4,9],.0001),round(table[4,10],.001)
mat list pval
mat beta = round(table[1,6],.01),round(table[1,7],.01),round(table[1,8],.01),round(table[1,9],.01),round(table[1,10],.01)
mat list beta

svy: reg w5_q19v3 i.w5_conjointgroup##ib0.amount_5G $pca if w5_conjointgroup<2 
margins , at(amount_5G = (0 1 2 3 4) w5_conjointgroup = (0 1) ) post
matrix list r(table)
mat table = r(table)
mat coef = table[1,6],table[1,7],table[1,8],table[1,9],table[1,10]
tempvar tvar1
tempvar tvar2
tempvar tvar3
tempvar tvar4
tempvar tvar5
tempvar tvar6

tempvar tvar8

gen `tvar1' = . 
gen `tvar2' = . 
gen `tvar3' = . 
gen `tvar5' = . 
gen `tvar8' = . 

replace `tvar1' = coef[1,1] in 1
di `tvar1'
di `tvar1' - 0.1
replace `tvar8' = `tvar1' - 0.012 in 1
di `tvar8'
replace `tvar2' = pval[1,1] in 1
replace `tvar3' = 0.125 in 1
replace `tvar5' = beta[1,1] in 1
replace `tvar1' = coef[1,2] in 2
replace `tvar8' = coef[1,2] - 0.012 in 2
replace `tvar2' = pval[1,2] in 2
replace `tvar3' = 1.125 in 2
replace `tvar5' = beta[1,2] in 2
replace `tvar1' = coef[1,3] in 3
replace `tvar8' = coef[1,3] - 0.012 in 3
replace `tvar2' = pval[1,3] in 3
replace `tvar3' = 2.125 in 3
replace `tvar5' = beta[1,3] in 3
replace `tvar1' = coef[1,4] in 4
replace `tvar8' = coef[1,4] - 0.012 in 4
replace `tvar2' = pval[1,4] in 4
replace `tvar3' = 3.125 in 4
replace `tvar5' = beta[1,4] in 4
replace `tvar1' = coef[1,5] in 5
replace `tvar8' = coef[1,5] - 0.012 in 5
replace `tvar2' = pval[1,5] in 5
replace `tvar3' = 4.125 in 5
replace `tvar5' = beta[1,5] in 5

gen  `tvar4' = string(`tvar2')
gen  `tvar6' = string(`tvar5')
replace `tvar6' = "{it:" + `tvar6' + "}"   in 1/5
replace `tvar4' = "{it:" + "(" + `tvar4' + ")" +"}"   in 1/5

di `tvar6'
di `tvar4'

replace `tvar4' = "{it:" + `tvar6' + `tvar4' + "}"   in 1/5

mplotoffset, offset(0.25)  recast(scatter)  xtitle("") name(two, replace) title("Worry for amount by no. and 5G treat.") ///
ylabel(0.1(.1)0.6) ///
 addplot( scatter `tvar1' `tvar3' ,  mlab(`tvar4') mlabcolor(black) mcolor(none) legend(bplacement(nwest)  order(3 "control group" 4 "5G" 5 "{it:diff. (p-val.)}"))  xmtick(4.5, tstyle(none))) 
 
// graph export "$fig\figA5.eps", replace

********************************************************************************
* Table A.5
********************************************************************************

eststo clear

eststo: svy: reg w5_q18rev   $pcacomponents if w5_conjointgroup == 0 ,  
eststo: svy: reg w5_q18v3  $pcacomponents if w5_conjointgroup == 0  ,  
eststo: svy: reg w5_q20    $pcacomponents if w5_conjointgroup == 0  ,  
eststo: svy: reg w5_q20bin    $pcacomponents if w5_conjointgroup == 0 ,  

eststo: svy: reg w5_q18rev   $pca if w5_conjointgroup == 0 ,  
eststo: svy: reg w5_q18v3  $pca if w5_conjointgroup == 0  ,  
eststo: svy: reg w5_q20    $pca if w5_conjointgroup == 0  ,  
eststo: svy: reg w5_q20bin    $pca if w5_conjointgroup == 0 ,  

eststo: svy: reg w5_q18rev   $pcabinary if w5_conjointgroup == 0 ,  
eststo: svy: reg w5_q18v3  $pcabinary if w5_conjointgroup == 0  ,  
eststo: svy: reg w5_q20    $pcabinary if w5_conjointgroup == 0  ,  
eststo: svy: reg w5_q20bin    $pcabinary if w5_conjointgroup == 0 ,  


esttab  ///   using "$tab\tabA5.tex" ///
, stats(N r2 ) label  nobaselevels  se nonote replace star(+ 0.1 * 0.05 ** 0.01 *** 0.001)  

********************************************************************************
********************************************************************************

* Table A.6

eststo clear

eststo: svy: reg w5_q18rev   $pca if w5_conjointgroup == 0 ,  
eststo: svy: reg w5_q18v3  $pca if w5_conjointgroup == 0  ,  
eststo: svy: reg w5_q20    $pca if w5_conjointgroup == 0  , 
eststo: svy: reg w5_q20bin    $pca if w5_conjointgroup == 0 ,  

eststo: svy: reg w5_q18rev   $soziodem if w5_conjointgroup == 0 ,  
eststo: svy: reg w5_q18v3  $soziodem if w5_conjointgroup == 0  ,  
eststo: svy: reg w5_q20    $soziodem if w5_conjointgroup == 0  ,  
eststo: svy: reg w5_q20bin    $soziodem if w5_conjointgroup == 0 , 

eststo: svy: reg w5_q18rev $pca  $soziodem if w5_conjointgroup == 0 ,  
eststo: svy: reg w5_q18v3 $pca $soziodem if w5_conjointgroup == 0  ,  
eststo: svy: reg w5_q20  $pca  $soziodem if w5_conjointgroup == 0  ,  
eststo: svy: reg w5_q20bin  $pca  $soziodem if w5_conjointgroup == 0 ,  

esttab   ///  using "$tab\tabA6" ///
, stats(N r2 ) label  nobaselevels  se nonote replace star(+ 0.1 * 0.05 ** 0.01 *** 0.001) 

********************************************************************************
********************************************************************************

* Figure A.6

eststo clear

global pca = "pca1 pca2"


** Panel 1
svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $pca if w5_conjointgroup<2 & benefitshigh == 0  & costshigh == 1, 

margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4) )
matrix list r(table)
mat table = r(table)
mat pval = round(table[4,5],.01),round(table[4,6],.01),round(table[4,7],.01),round(table[4,8],.01)
mat list pval
mat beta = round(table[1,5],.01),round(table[1,6],.01),round(table[1,7],.01),round(table[1,8],.01)
mat list beta

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $pca if w5_conjointgroup<2 & benefitshigh == 0  & costshigh == 1, 

margins , at(proximity_5Gv2 = (1 2 3 4) w5_conjointgroup = (0 1) ) post
matrix list r(table)
mat table = r(table)
mat coef = table[1,5],table[1,6],table[1,7],table[1,8]
tempvar tvar1
tempvar tvar2
tempvar tvar3
tempvar tvar4
tempvar tvar5
tempvar tvar6

gen `tvar1' = . 
gen `tvar2' = . 
gen `tvar3' = . 
gen `tvar5' = . 

replace `tvar1' = coef[1,1] in 1
replace `tvar2' = pval[1,1] in 1
replace `tvar3' = 1.125 in 1
replace `tvar5' = beta[1,1] in 1
replace `tvar1' = coef[1,2] in 2
replace `tvar2' = pval[1,2] in 2
replace `tvar3' = 2.125 in 2
replace `tvar5' = beta[1,2] in 2
replace `tvar1' = coef[1,3] in 3
replace `tvar2' = pval[1,3] in 3
replace `tvar3' = 3.125 in 3
replace `tvar5' = beta[1,3] in 3
replace `tvar1' = coef[1,4] in 4
replace `tvar2' = pval[1,4] in 4
replace `tvar3' = 4.125 in 4
replace `tvar5' = beta[1,4] in 4

gen  `tvar4' = string(`tvar2')
gen  `tvar6' = string(`tvar5')
replace `tvar4' = "{it:" + `tvar6' + "(" + `tvar4' + ")" + "}"   in 1/4
label variable `tvar1'  ""
 mplotoffset, offset(0.25)  recast(scatter)  xtitle("") name(one, replace) title("Resp.: below benefits, above costs")  ///
 addplot(scatter `tvar1' `tvar3' ,  mlab(`tvar4') mlabcolor(black) mcolor(none) legend(order(3 "control group" 4 "5G" 5 "{it:diff. (p-val.)}" )) ylabel(2(.25)5)   xmtick(4.5, tstyle(none))  ) 
  tab `tvar1' `tvar3'


** Panel 2
svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $pca if w5_conjointgroup<2 & benefitshigh == 1 & costshigh == 0, 

margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4) )
matrix list r(table)
mat table = r(table)
mat pval = round(table[4,5],.01),round(table[4,6],.01),round(table[4,7],.01),round(table[4,8],.01)
mat list pval
mat beta = round(table[1,5],.01),round(table[1,6],.01),round(table[1,7],.01),round(table[1,8],.01)
mat list beta

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $pca if w5_conjointgroup<2 & benefitshigh == 1 & costshigh == 0, 

margins , at(proximity_5Gv2 = (1 2 3 4) w5_conjointgroup = (0 1) ) post
matrix list r(table)
mat table = r(table)
mat coef = table[1,5],table[1,6],table[1,7],table[1,8]
tempvar tvar1
tempvar tvar2
tempvar tvar3
tempvar tvar4
tempvar tvar5
tempvar tvar6

gen `tvar1' = . 
gen `tvar2' = . 
gen `tvar3' = . 
gen `tvar5' = . 

replace `tvar1' = coef[1,1] in 1
replace `tvar2' = pval[1,1] in 1
replace `tvar3' = 1.125 in 1
replace `tvar5' = beta[1,1] in 1
replace `tvar1' = coef[1,2] in 2
replace `tvar2' = pval[1,2] in 2
replace `tvar3' = 2.125 in 2
replace `tvar5' = beta[1,2] in 2
replace `tvar1' = coef[1,3] in 3
replace `tvar2' = pval[1,3] in 3
replace `tvar3' = 3.125 in 3
replace `tvar5' = beta[1,3] in 3
replace `tvar1' = coef[1,4] in 4
replace `tvar2' = pval[1,4] in 4
replace `tvar3' = 4.125 in 4
replace `tvar5' = beta[1,4] in 4

gen  `tvar4' = string(`tvar2')
gen  `tvar6' = string(`tvar5')
replace `tvar4' = "{it:" + `tvar6' + "(" + `tvar4' + ")" + "}"   in 1/4
label variable `tvar1'  ""

  grstyle set legend 5, inside nobox

 mplotoffset, offset(0.25)  recast(scatter)  xtitle("") name(two, replace) title("Resp.: above benefits, below costs") ///
 addplot(scatter `tvar1' `tvar3' ,  mlab(`tvar4') mlabcolor(black) mcolor(none) legend(order(3 "control group" 4 "5G" 5 "{it:diff. (p-val.)}") ) ylabel(2(.25)5)  xmtick(4.5, tstyle(none))  )
  tab `tvar1' `tvar3'
   
     grstyle set legend 2, inside nobox

graph combine  two one, cols(1) name(leftside, replace)  


** Panel 3
svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $pca if w5_conjointgroup<2  & benefitshigh == 0  & costshigh == 0, 

margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4) )
matrix list r(table)
mat table = r(table)
mat pval = round(table[4,5],.01),round(table[4,6],.01),round(table[4,7],.01),round(table[4,8],.01)
mat list pval
mat beta = round(table[1,5],.01),round(table[1,6],.01),round(table[1,7],.01),round(table[1,8],.01)
mat list beta

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $pca if w5_conjointgroup<2  & benefitshigh == 0  & costshigh == 0, 

margins , at(proximity_5Gv2 = (1 2 3 4) w5_conjointgroup = (0 1) ) post
matrix list r(table)
mat table = r(table)
mat coef = table[1,5],table[1,6],table[1,7],table[1,8]
tempvar tvar1
tempvar tvar2
tempvar tvar3
tempvar tvar4
tempvar tvar5
tempvar tvar6

gen `tvar1' = . 
gen `tvar2' = . 
gen `tvar3' = . 
gen `tvar5' = . 

replace `tvar1' = coef[1,1] in 1
replace `tvar2' = pval[1,1] in 1
replace `tvar3' = 1.125 in 1
replace `tvar5' = beta[1,1] in 1
replace `tvar1' = coef[1,2] in 2
replace `tvar2' = pval[1,2] in 2
replace `tvar3' = 2.125 in 2
replace `tvar5' = beta[1,2] in 2
replace `tvar1' = coef[1,3] in 3
replace `tvar2' = pval[1,3] in 3
replace `tvar3' = 3.125 in 3
replace `tvar5' = beta[1,3] in 3
replace `tvar1' = coef[1,4] in 4
replace `tvar2' = pval[1,4] in 4
replace `tvar3' = 4.125 in 4
replace `tvar5' = beta[1,4] in 4

gen  `tvar4' = string(`tvar2')
gen  `tvar6' = string(`tvar5')
replace `tvar4' = "{it:" + `tvar6' + "(" + `tvar4' + ")" + "}"   in 1/4
label variable `tvar1'  ""
 mplotoffset, offset(0.25)  recast(scatter)  xtitle("") name(three, replace) title("Resp.: below benefits, below costs")  ///
 addplot(scatter `tvar1' `tvar3' ,  mlab(`tvar4') mlabcolor(black) mcolor(none) legend(order(3 "control group" 4 "5G" 5 "{it:diff. (p-val.)}")) ylabel(2(.25)5)  xmtick(4.5, tstyle(none))  )
  tab `tvar1' `tvar3'


** Panel 4
svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $pca if w5_conjointgroup<2  & benefitshigh == 1 & costshigh == 1, 

margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4) )
matrix list r(table)
mat table = r(table)
mat pval = round(table[4,5],.01),round(table[4,6],.01),round(table[4,7],.01),round(table[4,8],.01)
mat list pval
mat beta = round(table[1,5],.01),round(table[1,6],.01),round(table[1,7],.01),round(table[1,8],.01)
mat list beta

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $pca if w5_conjointgroup<2  & benefitshigh == 1 & costshigh == 1, 

margins , at(proximity_5Gv2 = (1 2 3 4) w5_conjointgroup = (0 1) ) post
matrix list r(table)
mat table = r(table)
mat coef = table[1,5],table[1,6],table[1,7],table[1,8]
tempvar tvar1
tempvar tvar2
tempvar tvar3
tempvar tvar4
tempvar tvar5
tempvar tvar6

gen `tvar1' = . 
gen `tvar2' = . 
gen `tvar3' = . 
gen `tvar5' = . 

replace `tvar1' = coef[1,1] in 1
replace `tvar2' = pval[1,1] in 1
replace `tvar3' = 1.125 in 1
replace `tvar5' = beta[1,1] in 1
replace `tvar1' = coef[1,2] in 2
replace `tvar2' = pval[1,2] in 2
replace `tvar3' = 2.125 in 2
replace `tvar5' = beta[1,2] in 2
replace `tvar1' = coef[1,3] in 3
replace `tvar2' = pval[1,3] in 3
replace `tvar3' = 3.125 in 3
replace `tvar5' = beta[1,3] in 3
replace `tvar1' = coef[1,4] in 4
replace `tvar2' = pval[1,4] in 4
replace `tvar3' = 4.125 in 4
replace `tvar5' = beta[1,4] in 4

gen  `tvar4' = string(`tvar2')
gen  `tvar6' = string(`tvar5')
replace `tvar4' = "{it:" + `tvar6' + "(" + `tvar4' + ")" + "}"   in 1/4
label variable `tvar1'  ""
 mplotoffset, offset(0.25)  recast(scatter)  xtitle("") name(four, replace) title("Resp.: above benefits, above costs") ///
 addplot(scatter `tvar1' `tvar3' ,  mlab(`tvar4') mlabcolor(black) mcolor(none) legend(order(3 "control group" 4 "5G" 5 "{it:diff. (p-val.)}")) ylabel(2(.25)5)  xmtick(4.5, tstyle(none))  )
  tab `tvar1' `tvar3'
   
graph combine  four three, cols(1) name(rightside, replace) 

graph combine  leftside rightside , title("5G pref. by distance and 5G treat.")

// graph export    "$fig\figA6.eps", replace

********************************************************************************
* Figure A.7
********************************************************************************

eststo clear


** Panel 1
svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $controls if w5_conjointgroup<2 & benefithigh == 0   , 

margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4) )
matrix list r(table)
mat table = r(table)
mat pval = round(table[4,5],.01),round(table[4,6],.01),round(table[4,7],.01),round(table[4,8],.01)
mat list pval
mat beta = round(table[1,5],.01),round(table[1,6],.01),round(table[1,7],.01),round(table[1,8],.01)
mat list beta

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $controls if w5_conjointgroup<2 & benefithigh == 0   , 

margins , at(proximity_5Gv2 = (1 2 3 4) w5_conjointgroup = (0 1) ) post
matrix list r(table)
mat table = r(table)
mat coef = table[1,5],table[1,6],table[1,7],table[1,8]
tempvar tvar1
tempvar tvar2
tempvar tvar3
tempvar tvar4
gen `tvar1' = . 
gen `tvar2' = . 
gen `tvar3' = . 
replace `tvar1' = coef[1,1] in 1
replace `tvar2' = pval[1,1] in 1
replace `tvar3' = 1.125 in 1
replace `tvar1' = coef[1,2] in 2
replace `tvar2' = pval[1,2] in 2
replace `tvar3' = 2.125 in 2
replace `tvar1' = coef[1,3] in 3
replace `tvar2' = pval[1,3] in 3
replace `tvar3' = 3.125 in 3
replace `tvar1' = coef[1,4] in 4
replace `tvar2' = pval[1,4] in 4
replace `tvar3' = 4.125 in 4
gen  `tvar4' = string(`tvar2')
replace `tvar4' = "{it:" + `tvar4' + "}"   in 1/4
label variable `tvar1'  ""
 mplotoffset, offset(0.25)  recast(scatter)  xtitle("") name(one, replace) title("Resp.: below median benefits")  ///
 addplot(scatter `tvar1' `tvar3' ,  mlab(`tvar4') mlabcolor(black) mcolor(none) legend(order(3 "control group" 4 "5G" 5 "{it:p-val. for diff.}")) ylabel(2(.25)5) )
  tab `tvar1' `tvar3'


** Panel 2
svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $controls if w5_conjointgroup<2 & benefithigh == 1  , 

margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4) )
matrix list r(table)
mat table = r(table)
mat pval = round(table[4,5],.01),round(table[4,6],.01),round(table[4,7],.01),round(table[4,8],.01)
mat list pval
mat beta = round(table[1,5],.01),round(table[1,6],.01),round(table[1,7],.01),round(table[1,8],.01)
mat list beta

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $controls if w5_conjointgroup<2 & benefithigh == 1  , 

margins , at(proximity_5Gv2 = (1 2 3 4) w5_conjointgroup = (0 1) ) post
matrix list r(table)
mat table = r(table)
mat coef = table[1,5],table[1,6],table[1,7],table[1,8]
tempvar tvar1
tempvar tvar2
tempvar tvar3
tempvar tvar4
gen `tvar1' = . 
gen `tvar2' = . 
gen `tvar3' = . 

replace `tvar1' = coef[1,1] in 1
replace `tvar2' = pval[1,1] in 1
replace `tvar3' = 1.125 in 1
replace `tvar1' = coef[1,2] in 2
replace `tvar2' = pval[1,2] in 2
replace `tvar3' = 2.125 in 2
replace `tvar1' = coef[1,3] in 3
replace `tvar2' = pval[1,3] in 3
replace `tvar3' = 3.125 in 3
replace `tvar1' = coef[1,4] in 4
replace `tvar2' = pval[1,4] in 4
replace `tvar3' = 4.125 in 4
gen  `tvar4' = string(`tvar2')
replace `tvar4' = "{it:" + `tvar4' + "}"   in 1/4
label variable `tvar1'  ""
 mplotoffset, offset(0.25)  recast(scatter)  xtitle("") name(two, replace) title("Resp.: above median benefits") ///
 addplot(scatter `tvar1' `tvar3' ,  mlab(`tvar4') mlabcolor(black) mcolor(none) legend(order(3 "control group" 4 "5G" 5 "{it:p-val. for diff.}")) ylabel(2(.25)5) )
  tab `tvar1' `tvar3'
   
graph combine  two one, cols(1) name(leftside, replace) 

** Panel 3
svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $controls if w5_conjointgroup<2  &  costhigh == 0, 

margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4) )
matrix list r(table)
mat table = r(table)
mat pval = round(table[4,5],.01),round(table[4,6],.01),round(table[4,7],.01),round(table[4,8],.01)
mat list pval
mat beta = round(table[1,5],.01),round(table[1,6],.01),round(table[1,7],.01),round(table[1,8],.01)
mat list beta

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $controls if w5_conjointgroup<2  &  costhigh == 0, 

margins , at(proximity_5Gv2 = (1 2 3 4) w5_conjointgroup = (0 1) ) post
matrix list r(table)
mat table = r(table)
mat coef = table[1,5],table[1,6],table[1,7],table[1,8]
tempvar tvar1
tempvar tvar2
tempvar tvar3
tempvar tvar4
gen `tvar1' = . 
gen `tvar2' = . 
gen `tvar3' = . 

replace `tvar1' = coef[1,1] in 1
replace `tvar2' = pval[1,1] in 1
replace `tvar3' = 1.125 in 1
replace `tvar1' = coef[1,2] in 2
replace `tvar2' = pval[1,2] in 2
replace `tvar3' = 2.125 in 2
replace `tvar1' = coef[1,3] in 3
replace `tvar2' = pval[1,3] in 3
replace `tvar3' = 3.125 in 3
replace `tvar1' = coef[1,4] in 4
replace `tvar2' = pval[1,4] in 4
replace `tvar3' = 4.125 in 4
gen  `tvar4' = string(`tvar2')
replace `tvar4' = "{it:" + `tvar4' + "}"   in 1/4
label variable `tvar1'  ""
 mplotoffset, offset(0.25)  recast(scatter)  xtitle("") name(three, replace) title("Resp.: below median costs")  ///
 addplot(scatter `tvar1' `tvar3' ,  mlab(`tvar4') mlabcolor(black) mcolor(none) legend(order(3 "control group" 4 "5G" 5 "{it:p-val. for diff.}")) ylabel(2(.25)5) )
  tab `tvar1' `tvar3'


** Panel 4
svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $controls if w5_conjointgroup<2  &  costhigh == 1, 

margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4) )
matrix list r(table)
mat table = r(table)
mat pval = round(table[4,5],.01),round(table[4,6],.01),round(table[4,7],.01),round(table[4,8],.01)
mat list pval
mat beta = round(table[1,5],.01),round(table[1,6],.01),round(table[1,7],.01),round(table[1,8],.01)
mat list beta

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $controls if w5_conjointgroup<2  &  costhigh == 1, 

margins , at(proximity_5Gv2 = (1 2 3 4) w5_conjointgroup = (0 1) ) post
matrix list r(table)
mat table = r(table)
mat coef = table[1,5],table[1,6],table[1,7],table[1,8]
tempvar tvar1
tempvar tvar2
tempvar tvar3
tempvar tvar4
gen `tvar1' = . 
gen `tvar2' = . 
gen `tvar3' = . 

replace `tvar1' = coef[1,1] in 1
replace `tvar2' = pval[1,1] in 1
replace `tvar3' = 1.125 in 1
replace `tvar1' = coef[1,2] in 2
replace `tvar2' = pval[1,2] in 2
replace `tvar3' = 2.125 in 2
replace `tvar1' = coef[1,3] in 3
replace `tvar2' = pval[1,3] in 3
replace `tvar3' = 3.125 in 3
replace `tvar1' = coef[1,4] in 4
replace `tvar2' = pval[1,4] in 4
replace `tvar3' = 4.125 in 4
gen  `tvar4' = string(`tvar2')
replace `tvar4' = "{it:" + `tvar4' + "}"   in 1/4
label variable `tvar1'  ""
 mplotoffset, offset(0.25)  recast(scatter)  xtitle("") name(four, replace) title("Resp.: above median costs") ///
 addplot(scatter `tvar1' `tvar3' ,  mlab(`tvar4') mlabcolor(black) mcolor(none) legend(order(3 "control group" 4 "5G" 5 "{it:p-val. for diff.}")) ylabel(2(.25)5) )
  tab `tvar1' `tvar3'
   
graph combine  four three, cols(1) name(rightside, replace) 

graph combine  leftside rightside , title("5G pref. by distance and 5G treat.") note("Dimensions 'benefits' and 'costs' from unrotated factors")

// graph export    "$fig\figA7.eps", replace

********************************************************************************
* Table A.7
********************************************************************************

*See end of code

********************************************************************************
* Table A.8
********************************************************************************

*See end of code

********************************************************************************
* Table A.9 
********************************************************************************

eststo clear

eststo: svy: reg w5_q20  i.w5_conjointgroup $pca   if w5_conjointgroup<2 ,
eststo: svy: reg w5_q20 i.w5_conjointgroup##ib3.proximity_5Gv2 $pca   if w5_conjointgroup<2 ,
eststo: svy: reg w5_q20bin  i.w5_conjointgroup $pca   if w5_conjointgroup<2 ,
eststo: svy: reg w5_q20bin i.w5_conjointgroup##ib3.proximity_5Gv2 $pca   if w5_conjointgroup<2 ,

esttab  /// using "$tab\tabA9.tex" ///
, stats(N r2 ) label  nobaselevels  se nonote replace star(+ 0.1 * 0.05 ** 0.01 *** 0.001) order(*w5_conjointgroup* *proximity_5Gv2* $pca ) ///
///
mgroups("5G and 3/4G" "5G" "5G and 3/4G" "5G", pattern(1 1 1 1) prefix(\multicolumn{@span}{c}{) suffix(}) span)

********************************************************************************
* Table A.10
********************************************************************************

eststo clear

eststo: svy: reg w5_q20 i.w5_conjointgroup##ib3.proximity_5Gv2 $pca if w5_conjointgroup<2 & benefitshigh == 0   , 
eststo: svy: reg w5_q20 i.w5_conjointgroup##ib3.proximity_5Gv2 $pca if w5_conjointgroup<2 & benefitshigh == 1  , 
eststo: svy: reg w5_q20 i.w5_conjointgroup##ib3.proximity_5Gv2 $pca if w5_conjointgroup<2  &  costshigh == 0, 
eststo: svy: reg w5_q20 i.w5_conjointgroup##ib3.proximity_5Gv2 $pca if w5_conjointgroup<2  &  costshigh == 1, 

esttab     ///   using "$tab\tabA10.tex" ///
, stats(N r2 ) label  noomitted  se nonote replace star(+ 0.1 * 0.05 ** 0.01 *** 0.001)  ///
mgroups("below median benefits" "above median benefits"   "below median costs" "above median costs", pattern(1 1 1 1 ) prefix(\multicolumn{@span}{c}{) suffix(}) span)

********************************************************************************
* Figure A.8
********************************************************************************

eststo clear

svy: reg w5_q25yes i.(w5_q25_treat1_de w5_q25_treat2_de w5_q25_treat3_de) polytwo1 polytwo2  if w5_conjointgroup == 0
eststo w5_q25yes0: margins w5_q25_treat1_de w5_q25_treat2_de w5_q25_treat3_de, post
svy: reg w5_q25yes i.(w5_q25_treat1_de w5_q25_treat2_de w5_q25_treat3_de) polytwo1 polytwo2  if w5_conjointgroup == 1  
eststo w5_q25yes1: margins w5_q25_treat1_de w5_q25_treat2_de w5_q25_treat3_de, post
svy: reg w5_q25yes i.(w5_q25_treat1_de w5_q25_treat2_de w5_q25_treat3_de) polytwo1 polytwo2  if w5_conjointgroup == 2  
eststo w5_q25yes2: margins w5_q25_treat1_de w5_q25_treat2_de w5_q25_treat3_de, post

coefplot (w5_q25yes0 ,   xscale(range(0.2(.05)0.4) ) ) (w5_q25yes1) (w5_q25yes2), ///  
drop(_cons)   baselevels byopts(xrescale) yline(5.5 9.5   , lcol(grey) lpattern(dash))  ///
legend(label(2 "Control") label( 4 "5G" ) label (6 "3/4G") pos(5) )

// graph export    "$fig\figA8.eps" , replace

********************************************************************************
* Table A.11
********************************************************************************

global pca = "pca1 pca2"
global pcacomponents = "w5_q5 i.( w5_q29  w5_q30x1 w5_q30x2 w5_q30x8) "
global pcabinary = "benefitshigh costshigh "
global soziodem = "i.language rural i.agecat  i.marital_3cat  i.hhsize i.nationality_Swiss i.edu i.income i.leftright"

eststo clear

eststo: svy: reg w5_q18v3 i.w5_conjointgroup $pca if w5_conjointgroup<2
eststo: svy: reg w5_q18rev i.w5_conjointgroup $pca  if w5_conjointgroup<2

eststo: svy: reg w5_q18v3 i.w5_conjointgroup if w5_conjointgroup<2
eststo: svy: reg w5_q18rev i.w5_conjointgroup if w5_conjointgroup<2

eststo: svy: reg w5_q18v3 i.w5_conjointgroup $soziodem if w5_conjointgroup<2
eststo: svy: reg w5_q18rev i.w5_conjointgroup $soziodem if w5_conjointgroup<2

eststo: svy: reg w5_q18v3 i.w5_conjointgroup $soziodem $pca if w5_conjointgroup<2
eststo: svy: reg w5_q18rev i.w5_conjointgroup $soziodem $pca if w5_conjointgroup<2

esttab /// using "$tab\tabA11.tex" /// 
, stats(N r2 ) label  noomitted  se nonote replace star(+ 0.1 * 0.05 ** 0.01 *** 0.001)  ///
mgroups("Only PCA controls" "No controls" "Only sociodem. controls" "PCA and sociodem. controls", pattern(1 0 1 0 1 0 1 0) prefix(\multicolumn{@span}{c}{) suffix(}) span)

********************************************************************************
* Table A.12
********************************************************************************

eststo clear

eststo: svy: reg w5_q20  i.w5_conjointgroup $pca   if w5_conjointgroup<2 
eststo: svy: reg w5_q20bin  i.w5_conjointgroup $pca   if w5_conjointgroup<2 

eststo: svy: reg w5_q20  i.w5_conjointgroup   if w5_conjointgroup<2
eststo: svy: reg w5_q20bin  i.w5_conjointgroup    if w5_conjointgroup<2

eststo: svy: reg w5_q20  i.w5_conjointgroup $soziodem  if w5_conjointgroup<2 
eststo: svy: reg w5_q20bin  i.w5_conjointgroup $soziodem   if w5_conjointgroup<2

eststo: svy: reg w5_q20  i.w5_conjointgroup $soziodem $pca if w5_conjointgroup<2
eststo: svy: reg w5_q20bin  i.w5_conjointgroup $soziodem $pca  if w5_conjointgroup<2 

esttab /// using "$tab\tabA12.tex" /// 
, stats(N r2 ) label  noomitted  se nonote replace star(+ 0.1 * 0.05 ** 0.01 *** 0.001)  ///
mgroups("Only PCA controls" "No controls" "Only sociodem. controls" "PCA and sociodem. controls", pattern(1 0 1 0 1 0 1 0) prefix(\multicolumn{@span}{c}{) suffix(}) span) 

********************************************************************************
* Table A.13
********************************************************************************

eststo clear

svy: reg w5_q18v3 i.w5_conjointgroup##ib3.proximity_5Gv2 $pca if w5_conjointgroup<2 
eststo: margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4)) post 

svy: reg w5_q18v3 i.w5_conjointgroup##ib3.proximity_5Gv2  if w5_conjointgroup<2 
eststo: margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4)) post 

svy: reg w5_q18v3 i.w5_conjointgroup##ib3.proximity_5Gv2 $soziodem if w5_conjointgroup<2 
eststo: margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4)) post 

svy: reg w5_q18v3 i.w5_conjointgroup##ib3.proximity_5Gv2 $soziodem $pca if w5_conjointgroup<2 
eststo: margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4)) post 


esttab /// using "$tab\tabA13.tex" /// 
, stats(N   ) label  noomitted  se nonote replace star(+ 0.1 * 0.05 ** 0.01 *** 0.001)  /// 
mgroups("Only PCA controls" "No controls" "Only sociodem. controls" "PCA and sociodem. controls", pattern(1 1 1 1) prefix(\multicolumn{@span}{c}{) suffix(}) span) 

********************************************************************************
* Table A.14
********************************************************************************

eststo clear

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $pca  if w5_conjointgroup<2 , 
eststo:  margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4)) post 

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2   if w5_conjointgroup<2 , 
eststo: margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4)) post 

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $soziodem  if w5_conjointgroup<2 , 
eststo: margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4)) post 

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $soziodem $pca if w5_conjointgroup<2 , 
eststo: margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4)) post 

esttab /// using "$tab\tabA14.tex" /// 
, stats(N   ) label  noomitted  se nonote replace star(+ 0.1 * 0.05 ** 0.01 *** 0.001)  /// 
mgroups("Only PCA controls" "No controls" "Only sociodem. controls" "PCA and sociodem. controls", pattern(1 1 1 1) prefix(\multicolumn{@span}{c}{) suffix(}) span) 

********************************************************************************
* Table A.15 and Table A.16
********************************************************************************

eststo clear

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $pca if w5_conjointgroup<2 & benefitshigh == 0   , 
eststo a1: margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4)) post

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $pca if w5_conjointgroup<2 & benefitshigh == 1   , 
eststo b1: margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4)) post

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $pca if w5_conjointgroup<2 & costshigh == 0   , 
eststo c1: margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4)) post

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $pca if w5_conjointgroup<2 & costshigh == 1   , 
eststo d1: margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4)) post

*

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2  if w5_conjointgroup<2 & benefitshigh == 0   , 
eststo a2: margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4)) post

svy : reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2  if w5_conjointgroup<2 & benefitshigh == 1   , 
eststo b2: margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4)) post

svy : reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2  if w5_conjointgroup<2 & costshigh == 0   , 
eststo c2: margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4)) post

svy : reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2  if w5_conjointgroup<2 & costshigh == 1   , 
eststo d2: margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4)) post

*

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $soziodem if w5_conjointgroup<2 & benefitshigh == 0   , 
eststo a3: margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4)) post

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $soziodem if w5_conjointgroup<2 & benefitshigh == 1   , 
eststo b3: margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4)) post

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $soziodem if w5_conjointgroup<2 & costshigh == 0   , 
eststo c3: margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4)) post

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $soziodem if w5_conjointgroup<2 & costshigh == 1   , 
eststo d3: margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4)) post

*

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $soziodem $pca if w5_conjointgroup<2 & benefitshigh == 0   , 
eststo a4: margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4)) post

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $soziodem $pca if w5_conjointgroup<2 & benefitshigh == 1   , 
eststo b4: margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4)) post

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $soziodem $pca if w5_conjointgroup<2 & costshigh == 0   , 
eststo c4: margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4)) post

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_5Gv2 $soziodem $pca  if w5_conjointgroup<2 & costshigh == 1   , 
eststo d4: margins , dydx(w5_conjointgroup) at(proximity_5Gv2 = (1 2 3 4)) post


esttab a? b? /// using "$tab\tabA15.tex"  /// 
, stats(N   ) label  noomitted  se nonote replace star(+ 0.1 * 0.05 ** 0.01 *** 0.001)  /// 
mgroups("Only PCA controls" "No controls" "Only sociodem. controls" "PCA and sociodem. controls" "Only PCA controls" "No controls" "Only sociodem. controls" "PCA and sociodem. controls", pattern(1 1 1 1 1 1 1 1 ) prefix(\multicolumn{@span}{c}{) suffix(}) span)  note(     \multicolumn{4}{c}{Below median benefits} \multicolumn{4}{c}{Above median benefits}   )

esttab c? d? /// using "$tab\tabA16.tex"  /// 
, stats(N   ) label  noomitted  se nonote replace star(+ 0.1 * 0.05 ** 0.01 *** 0.001)  /// 
mgroups("Only PCA controls" "No controls" "Only sociodem. controls" "PCA and sociodem. controls" "Only PCA controls" "No controls" "Only sociodem. controls" "PCA and sociodem. controls", pattern(1 1 1 1 1 1 1 1 ) prefix(\multicolumn{@span}{c}{) suffix(}) span)  note(     \multicolumn{4}{c}{Below median costs} \multicolumn{4}{c}{Above median costs}   )


****************************************************************************************************************
********************************************************
* Appendix B Tables and Figures (in order of appearance)
********************************************************
****************************************************************************************************************

********************************************************
* Figure B.3
********************************************************

eststo clear

svy: reg comprmatch4G i.w5_conjointgroup##ib3.proximity_4Gv2 $pca if w5_conjointgroup!=1
margins , at(proximity_4Gv2 = (1 2 3 4) w5_conjointgroup = (0 2) )
mplotoffset, offset(0.25)  recast(scatter)  xtitle("")  name(two, replace) title("Comprehension by distance and 3/4G treat.")

// graph export "$fig\figB3.eps", replace

********************************************************************************
* Table B.1 
********************************************************************************

eststo clear

eststo: svy: reg comprmatch4G i.w5_conjointgroup $pca
eststo: svy: reg comprmatch4G i.w5_conjointgroup##ib3.proximity_4Gv2 $pca
eststo: svy: reg comprmatch4Gv2 i.w5_conjointgroup $pca
eststo: svy: reg comprmatch4Gv2 i.w5_conjointgroup##ib3.proximity_4Gv2 $pca

esttab /// using "$tab\tabB1.tex" ///
, stats(N r2 ) label  nobaselevels  se nonote replace star(+ 0.1 * 0.05 ** 0.01 *** 0.001)order(*w5_conjointgroup* *proximity_4Gv2*)  ///
mgroups("3/4G", pattern(1 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span)

********************************************************************************
* Table B.2 
********************************************************************************

eststo clear

eststo: svy: reg w5_q18v3 i.w5_conjointgroup $pca if w5_conjointgroup!=1
eststo: svy: reg w5_q18v3 i.w5_conjointgroup##ib3.proximity_4Gv2 $pca if w5_conjointgroup!=1
eststo: svy: reg w5_q18 i.w5_conjointgroup $pca if w5_conjointgroup!=1
eststo: svy: reg w5_q18 i.w5_conjointgroup##ib3.proximity_4Gv2 $pca if w5_conjointgroup!=1

esttab /// using "$tab\tabB2.tex" ///
, stats(N r2 ) label  nobaselevels  se nonote replace star(+ 0.1 * 0.05 ** 0.01 *** 0.001) order(*w5_conjointgroup* *proximity_4Gv2* ) ///
mgroups("5G and 3/4G" "3/4G", pattern(1 1 1 1) prefix(\multicolumn{@span}{c}{) suffix(}) span)

********************************************************************************
* Figure B.4
********************************************************************************

svy: reg w5_q18v3 i.w5_conjointgroup##ib3.proximity_4Gv2 $pca if w5_conjointgroup!=1
margins , at(proximity_4Gv2 = (1 2 3 4) w5_conjointgroup = (0 2) )
mplotoffset, offset(0.25)  recast(scatter)  xtitle("")  name(two, replace) title("Worry for prox. by distance and 3/4G treat.") ///
ylabel(0.1(.1)0.6)

// graph export "$fig\figB4.eps", replace

********************************************************************************
* Figure B.5 
********************************************************************************

eststo clear

svy: reg w5_q19v3 i.w5_conjointgroup##ib0.amount_4G $pca if w5_conjointgroup!=1
margins , at(amount_4G = (0 1 2 3 4 5) w5_conjointgroup = (0 2) )
marginsplot, by(amount_4G) byopts(rows(1)) // 
mplotoffset, offset(0.25)  recast(scatter)  xtitle("")  name(two, replace) title("Worry for amount by no. and 3/4G treat.") ///
ylabel(0.1(.1)0.6)

// graph export "$fig\fibB5.eps", replace

********************************************************************************
* Table B.3
********************************************************************************

eststo clear

eststo: svy: reg w5_q19v3 i.w5_conjointgroup $pca if w5_conjointgroup!=1
eststo: svy: reg w5_q19v3 i.w5_conjointgroup##ib0.amount_4G $pca if w5_conjointgroup!=1
eststo: svy: reg w5_q19 i.w5_conjointgroup $pca if w5_conjointgroup!=1
eststo: svy: reg w5_q19 i.w5_conjointgroup##ib0.amount_4G $pca if w5_conjointgroup!=1

esttab /// using "$tab\tabB3.tex" ///
, stats(N r2 ) label  nobaselevels  se nonote replace star(+ 0.1 * 0.05 ** 0.01 *** 0.001)order(*w5_conjointgroup* *amount_4G*)  ///
mgroups("5G and 3/4G" "3/4G" "5G and 3/4G" "3/4G", pattern(1 1 1 1) prefix(\multicolumn{@span}{c}{) suffix(}) span)

********************************************************************************
* Table B.4 
********************************************************************************

eststo clear

eststo: svy: reg w5_q20  i.w5_conjointgroup $pca   if w5_conjointgroup!=1 ,
eststo: svy: reg w5_q20 i.w5_conjointgroup##ib3.proximity_4Gv2 $pca   if w5_conjointgroup!=1 ,
eststo: svy: reg w5_q20bin  i.w5_conjointgroup $pca   if w5_conjointgroup!=1 ,
eststo: svy: reg w5_q20bin i.w5_conjointgroup##ib3.proximity_4Gv2 $pca   if w5_conjointgroup!=1 ,

esttab  ///  using "$tab\tabB4.tex" ///
, stats(N r2 ) label  nobaselevels  se nonote replace star(+ 0.1 * 0.05 ** 0.01 *** 0.001) order(*w5_conjointgroup* *proximity_4Gv2* $pca ) ///
///
mgroups("5G and 3/4G" "3/4G" "5G and 3/4G" "3/4G", pattern(1 1 1 1) prefix(\multicolumn{@span}{c}{) suffix(}) span)

********************************************************************************
* Figure B.6 
********************************************************************************

eststo clear

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_4Gv2 $pca  if w5_conjointgroup!=1, 

margins , dydx(w5_conjointgroup) at(proximity_4Gv2 = (1 2 3 4) )
matrix list r(table)
mat table = r(table)
mat pval = round(table[4,5],.01),round(table[4,6],.01),round(table[4,7],.01),round(table[4,8],.01)
mat list pval
mat beta = round(table[1,5],.01),round(table[1,6],.01),round(table[1,7],.01),round(table[1,8],.01)
mat list beta

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_4Gv2 $pca  if w5_conjointgroup!=1, 

margins , at(proximity_4Gv2 = (1 2 3 4) w5_conjointgroup = (0 2) ) post
matrix list r(table)
mat table = r(table)
mat coef = table[1,5],table[1,6],table[1,7],table[1,8]
tempvar tvar1
tempvar tvar2
tempvar tvar3
tempvar tvar4
tempvar tvar5
tempvar tvar6

gen `tvar1' = . 
gen `tvar2' = . 
gen `tvar3' = . 
gen `tvar5' = . 

replace `tvar1' = coef[1,1] in 1
replace `tvar2' = pval[1,1] in 1
replace `tvar3' = 1.125 in 1
replace `tvar5' = beta[1,1] in 1
replace `tvar1' = coef[1,2] in 2
replace `tvar2' = pval[1,2] in 2
replace `tvar3' = 2.125 in 2
replace `tvar5' = beta[1,2] in 2
replace `tvar1' = coef[1,3] in 3
replace `tvar2' = pval[1,3] in 3
replace `tvar3' = 3.125 in 3
replace `tvar5' = beta[1,3] in 3
replace `tvar1' = coef[1,4] in 4
replace `tvar2' = pval[1,4] in 4
replace `tvar3' = 4.125 in 4
replace `tvar5' = beta[1,4] in 4

gen  `tvar4' = string(`tvar2')
gen  `tvar6' = string(`tvar5')
replace `tvar4' = "{it:" + `tvar6' + "(" + `tvar4' + ")" + "}"   in 1/4

mplotoffset, offset(0.25)  recast(scatter)  xtitle("")  name(two, replace) title("5G preference by distance and 3/4G treat.") ///
 addplot(scatter `tvar1' `tvar3' ,  mlab(`tvar4') mlabcolor(black) mcolor(none) legend(order(3 "control group" 4 "3/4G" 5 "{it:diff. (p-val.)}")) ylabel(3(.2)4) ) xmtick(4.5, tstyle(none))

// graph export "$fig\figB6.eps", name(two) replace

********************************************************************************
* Figure B.7 
********************************************************************************

eststo clear

** Panel 1
svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_4Gv2 $pca if w5_conjointgroup!=1 & benefitshigh == 0   , 

margins , dydx(w5_conjointgroup) at(proximity_4Gv2 = (1 2 3 4) )
matrix list r(table)
mat table = r(table)
mat pval = round(table[4,5],.01),round(table[4,6],.01),round(table[4,7],.01),round(table[4,8],.01)
mat list pval
mat beta = round(table[1,5],.01),round(table[1,6],.01),round(table[1,7],.01),round(table[1,8],.01)
mat list beta

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_4Gv2 $pca if w5_conjointgroup!=1 & benefitshigh == 0   , 

margins , at(proximity_4Gv2 = (1 2 3 4) w5_conjointgroup = (0 2) ) post
matrix list r(table)
mat table = r(table)
mat coef = table[1,5],table[1,6],table[1,7],table[1,8]
tempvar tvar1
tempvar tvar2
tempvar tvar3
tempvar tvar4
tempvar tvar5
tempvar tvar6

gen `tvar1' = . 
gen `tvar2' = . 
gen `tvar3' = . 
gen `tvar5' = . 

replace `tvar1' = coef[1,1] in 1
replace `tvar2' = pval[1,1] in 1
replace `tvar3' = 1.125 in 1
replace `tvar5' = beta[1,1] in 1
replace `tvar1' = coef[1,2] in 2
replace `tvar2' = pval[1,2] in 2
replace `tvar3' = 2.125 in 2
replace `tvar5' = beta[1,2] in 2
replace `tvar1' = coef[1,3] in 3
replace `tvar2' = pval[1,3] in 3
replace `tvar3' = 3.125 in 3
replace `tvar5' = beta[1,3] in 3
replace `tvar1' = coef[1,4] in 4
replace `tvar2' = pval[1,4] in 4
replace `tvar3' = 4.125 in 4
replace `tvar5' = beta[1,4] in 4

gen  `tvar4' = string(`tvar2')
gen  `tvar6' = string(`tvar5')
replace `tvar4' = "{it:" + `tvar6' + "(" + `tvar4' + ")" + "}"   in 1/4
label variable `tvar1'  ""
 mplotoffset, offset(0.25)  recast(scatter)  xtitle("") name(one, replace) title("Resp.: below median benefits")  ///
 addplot(scatter `tvar1' `tvar3' ,  mlab(`tvar4') mlabcolor(black) mcolor(none) msymbol(none) legend(order(3 "control group" 4 "3/4G" 5 "{it:diff. (p-val.)}")) ylabel(2(.25)5) ) xmtick(4.5, tstyle(none))  
  tab `tvar1' `tvar3'


** Panel 2
svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_4Gv2 $pca if w5_conjointgroup!=1 & benefitshigh == 1  , 

margins , dydx(w5_conjointgroup) at(proximity_4Gv2 = (1 2 3 4) )
matrix list r(table)
mat table = r(table)
mat pval = round(table[4,5],.01),round(table[4,6],.01),round(table[4,7],.01),round(table[4,8],.01)
mat list pval
mat beta = round(table[1,5],.01),round(table[1,6],.01),round(table[1,7],.01),round(table[1,8],.01)
mat list beta

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_4Gv2 $pca if w5_conjointgroup!=1 & benefitshigh == 1  , 

margins , at(proximity_4Gv2 = (1 2 3 4) w5_conjointgroup = (0 2) ) post
matrix list r(table)
mat table = r(table)
mat coef = table[1,5],table[1,6],table[1,7],table[1,8]
tempvar tvar1
tempvar tvar2
tempvar tvar3
tempvar tvar4
tempvar tvar5
tempvar tvar6

gen `tvar1' = . 
gen `tvar2' = . 
gen `tvar3' = . 
gen `tvar5' = . 

replace `tvar1' = coef[1,1] in 1
replace `tvar2' = pval[1,1] in 1
replace `tvar3' = 1.125 in 1
replace `tvar5' = beta[1,1] in 1
replace `tvar1' = coef[1,2] in 2
replace `tvar2' = pval[1,2] in 2
replace `tvar3' = 2.125 in 2
replace `tvar5' = beta[1,2] in 2
replace `tvar1' = coef[1,3] in 3
replace `tvar2' = pval[1,3] in 3
replace `tvar3' = 3.125 in 3
replace `tvar5' = beta[1,3] in 3
replace `tvar1' = coef[1,4] in 4
replace `tvar2' = pval[1,4] in 4
replace `tvar3' = 4.125 in 4
replace `tvar5' = beta[1,4] in 4

gen  `tvar4' = string(`tvar2')
gen  `tvar6' = string(`tvar5')
replace `tvar4' = "{it:" + `tvar6' + "(" + `tvar4' + ")" + "}"   in 1/4
label variable `tvar1'  ""

  grstyle set legend 5, inside nobox

 mplotoffset, offset(0.25)  recast(scatter)  xtitle("") name(two, replace) title("Resp.: above median benefits") ///
 addplot(scatter `tvar1' `tvar3' ,  mlab(`tvar4') mlabcolor(black) mcolor(none) msymbol(none) legend(order(3 "control group" 4 "3/4G" 5 "{it:diff. (p-val.)}")) ylabel(2(.25)5) ) xmtick(4.5, tstyle(none))  
  tab `tvar1' `tvar3'

    grstyle set legend 2, inside nobox

graph combine  two one, cols(1) name(leftside, replace) 

** Panel 3
svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_4Gv2 $pca if w5_conjointgroup!=1  &  costshigh == 0, 

margins , dydx(w5_conjointgroup) at(proximity_4Gv2 = (1 2 3 4) )
matrix list r(table)
mat table = r(table)
mat pval = round(table[4,5],.01),round(table[4,6],.01),round(table[4,7],.01),round(table[4,8],.01)
mat list pval
mat beta = round(table[1,5],.01),round(table[1,6],.01),round(table[1,7],.01),round(table[1,8],.01)
mat list beta

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_4Gv2 $pca if w5_conjointgroup!=1  &  costshigh == 0, 

margins , at(proximity_4Gv2 = (1 2 3 4) w5_conjointgroup = (0 2) ) post
matrix list r(table)
mat table = r(table)
mat coef = table[1,5],table[1,6],table[1,7],table[1,8]
tempvar tvar1
tempvar tvar2
tempvar tvar3
tempvar tvar4
tempvar tvar5
tempvar tvar6

gen `tvar1' = . 
gen `tvar2' = . 
gen `tvar3' = . 
gen `tvar5' = . 

replace `tvar1' = coef[1,1] in 1
replace `tvar2' = pval[1,1] in 1
replace `tvar3' = 1.125 in 1
replace `tvar5' = beta[1,1] in 1
replace `tvar1' = coef[1,2] in 2
replace `tvar2' = pval[1,2] in 2
replace `tvar3' = 2.125 in 2
replace `tvar5' = beta[1,2] in 2
replace `tvar1' = coef[1,3] in 3
replace `tvar2' = pval[1,3] in 3
replace `tvar3' = 3.125 in 3
replace `tvar5' = beta[1,3] in 3
replace `tvar1' = coef[1,4] in 4
replace `tvar2' = pval[1,4] in 4
replace `tvar3' = 4.125 in 4
replace `tvar5' = beta[1,4] in 4

gen  `tvar4' = string(`tvar2')
gen  `tvar6' = string(`tvar5')
replace `tvar4' = "{it:" + `tvar6' + "(" + `tvar4' + ")" + "}"   in 1/4
label variable `tvar1'  ""

  grstyle set legend 5, inside nobox

 mplotoffset, offset(0.25)  recast(scatter)  xtitle("") name(three, replace) title("Resp.: below median costs")  ///
 addplot(scatter `tvar1' `tvar3' ,  mlab(`tvar4') mlabcolor(black) mcolor(none) msymbol(none) legend(order(3 "control group" 4 "3/4G" 5 "{it:diff. (p-val.)}")) ylabel(2(.25)5) ) xmtick(4.5, tstyle(none))  

   grstyle set legend 2, inside nobox

 tab `tvar1' `tvar3'


** Panel 4
svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_4Gv2 $pca if w5_conjointgroup!=1  &  costshigh == 1, 

margins , dydx(w5_conjointgroup) at(proximity_4Gv2 = (1 2 3 4) )
matrix list r(table)
mat table = r(table)
mat pval = round(table[4,5],.01),round(table[4,6],.01),round(table[4,7],.01),round(table[4,8],.01)
mat list pval
mat beta = round(table[1,5],.01),round(table[1,6],.01),round(table[1,7],.01),round(table[1,8],.01)
mat list beta

svy: reg w5_q20 i.w5_conjointgroup##ib1.proximity_4Gv2 $pca if w5_conjointgroup!=1  &  costshigh == 1, 

margins , at(proximity_4Gv2 = (1 2 3 4) w5_conjointgroup = (0 2) ) post
matrix list r(table)
mat table = r(table)
mat coef = table[1,5],table[1,6],table[1,7],table[1,8]
tempvar tvar1
tempvar tvar2
tempvar tvar3
tempvar tvar4
tempvar tvar5
tempvar tvar6

gen `tvar1' = . 
gen `tvar2' = . 
gen `tvar3' = . 
gen `tvar5' = . 

replace `tvar1' = coef[1,1] in 1
replace `tvar2' = pval[1,1] in 1
replace `tvar3' = 1.125 in 1
replace `tvar5' = beta[1,1] in 1
replace `tvar1' = coef[1,2] in 2
replace `tvar2' = pval[1,2] in 2
replace `tvar3' = 2.125 in 2
replace `tvar5' = beta[1,2] in 2
replace `tvar1' = coef[1,3] in 3
replace `tvar2' = pval[1,3] in 3
replace `tvar3' = 3.125 in 3
replace `tvar5' = beta[1,3] in 3
replace `tvar1' = coef[1,4] in 4
replace `tvar2' = pval[1,4] in 4
replace `tvar3' = 4.125 in 4
replace `tvar5' = beta[1,4] in 4

gen  `tvar4' = string(`tvar2')
gen  `tvar6' = string(`tvar5')
replace `tvar4' = "{it:" + `tvar6' + "(" + `tvar4' + ")" + "}"   in 1/4
label variable `tvar1'  ""
 mplotoffset, offset(0.25)  recast(scatter)  xtitle("") name(four, replace) title("Resp.: above median costs") ///
 addplot(scatter `tvar1' `tvar3' ,  mlab(`tvar4') mlabcolor(black) mcolor(none) msymbol(none) legend(order(3 "control group" 4 "3/4G" 5 "{it:diff. (p-val.)}")) ylabel(2(.25)5) ) xmtick(4.5, tstyle(none))  
  tab `tvar1' `tvar3'
   
graph combine  four three, cols(1) name(rightside, replace) 

graph combine  leftside rightside , title("5G pref. by distance and 3/4G treat.")

// graph export    "$fig\figB7.eps", replace


********************************************************************************
* Table A.7 and A.8
********************************************************************************

********************
use tabA7_A8_figA1_A2_replication_data.dta, clear // load data set with information from respondents in both the survey arm with our map experiment and an unrelated survey arm
********************

*** prepare data
gen w5_weightA = . 
replace w5_weightA = 1 if w5_bigreg <= 6
replace w5_weightA = .5 if w5_bigreg == 7

recode w5_q29 -77=.

label variable w5_q29 "electrosensitivity"

label define es 1 "no" 2 "unsure" 3 "yes", replace
label values w5_q29 es

label define sa 0 "no map treatment" 1 "map treatment", replace
label values w5_surveyarm sa

gen groupindicator = .
replace groupindicator = w5_surveyarm  
replace groupindicator = w5_conjointgroup+1 if w5_surveyarm  == 1
label define exp_group 0 "no map treatment" 1 "map control" 2 "5G map" 3 "3/4G map", replace
label values groupindicator exp_group


** Table A.8  

eststo clear

eststo: ologit w5_q29 i.w5_surveyarm   [pweight=w5_weightA]
eststo: ologit w5_q29 i.groupindicator  [pweight=w5_weightA]
eststo: ologit w5_q29 i.w5_conjointgroup if  w5_surveyarm == 1 [pweight=w5_weightA]
 ologit w5_q29 i.w5_conjointgroup if  w5_surveyarm == 0 [pweight=w5_weightA]

esttab   ///  using "$tab\tabA8.tex" ///
, label se   replace star(+ 0.1 * 0.05 ** 0.01 *** 0.001)


** Table A.7  

label variable w5_q30x1 "Smartphone"
label variable w5_q30x2 "Tablet"
label variable w5_q30x8 "Streaming"

recode w5_q30x1 w5_q30x2 w5_q30x8 (-77 = .)

eststo clear
foreach x in  w5_q30x1 w5_q30x2 w5_q30x8 {
	local label : variable label `x'
	eststo `x'_1: reg `x' i.w5_surveyarm   [pweight=w5_weightA], r
		eststo `x'_2: reg `x'  i.groupindicator  [pweight=w5_weightA] ,r
	eststo `x'_3: reg `x' i.w5_conjointgroup if  w5_surveyarm == 1 [pweight=w5_weightA] , r
 
}
esttab   ///  using "$tab\tabA7.tex" ///
, label se   replace star(+ 0.1 * 0.05 ** 0.01 *** 0.001)



***************************************************************************************************************
* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX        END        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX *
***************************************************************************************************************
